<?php
namespace hc;
class cache{
 	protected static $instance =[];
    public static function init($config=array()){
    	if(empty($config)){
			$config=C('cache');
		}
    	$cache_type=$config['type'];
		if(!empty($cache_type)){
			$class='\\cache\\cache_'.$cache_type;
			if(!isset(self::$instance[$class])){
				self::$instance[$class]=new $class($config);
			}
			return self::$instance[$class];
			
		}else{
			msg_error('缓存类型cache——type不存在');
		}
	}
}
